package leetcode.lcp.lcp20220423;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution1 implements IDebug {

	public int getMinimumTime(int[] time, int[][] fruits, int limit) {
		int ans = 0;
		for (int i = 0; i < fruits.length; i++) {
			int[] fruit = fruits[i];
			int num = fruit[1], type = fruit[0];
			int t = (num + limit - 1) / limit * time[type];
			ans += t;
		}
		return ans;
	}

	@Override
	public void debug4() {
		H.compare(10, this.getMinimumTime(H.str2array3("[2,3,2]"), H.str2array1("[[0,2],[1,4],[2,1]]"), 3));
		H.compare(5, this.getMinimumTime(H.str2array3("[1]"), H.str2array1("[[0,3],[0,5]]"), 2));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution1 so = new Solution1();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
